// pages/doctorhomepage/doctorinfo/doctorinfo.js
var app=getApp()
Page({
  data: {
    doctorname:''
  },

  onShareAppMessage: function () {
  },
  onLoad: function (e) {
    var that = this
    this.setData({
      doctorname: e.doctorname,
    });
    console.info('--------' + e.doctorname);
    var doctorname = e.doctorname;

    console.log('用户name值为' + doctorname),
    wx.request({
      url: app.globalData.url + '/API/doctorinfo?doctorname=' + doctorname,
        method: 'get',
        header: {
          'content-type': 'application/json'
        },
        success: function (res) {
          console.log(res.data);
          var list = res.data;
          if (list == null) {
            var toastText = '医生数据获取失败';
            wx.showToast({
              title: toastText,
              icon: '',
              duration: 2000
            });
          } else {
            that.setData({
              list: list
            })
          }
        },
        fail: function () {
          console.log("------------fail-------------");
        }
    })
  },

})